package com.dodo.blog.server;

import com.dodo.blog.model.Category;
import com.dodo.blog.request.BasicRequest;

import java.util.List;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public interface CategoryService
{
    /**
     * Return list of {@link com.dodo.blog.model.Category}
     *
     * @param request contains ordering and result properties
     * @return list of {@link com.dodo.blog.model.Category}
     */
    List<Category> getCategoryList( BasicRequest request );

    /**
     * Save category to datastore
     *
     * @param category {@link com.dodo.blog.model.Category} entity to save
     */
    void saveCategory( Category category );

    /**
     * Get category by id
     *
     * @param id id of {@link com.dodo.blog.model.Category} entity
     * @return category by id
     */
    Category getCategoryById( Long id );

    /**
     * <p>Get category by normalized name. Normalized name is lowercase dash replaced space version of name.</p>
     * <p>So name <em>Google App Engine</em> became <em>google-app-engine</em></p>
     *
     * @param name normalized name of the category
     * @return {@link Category}
     */
    Category getCategoryByNormalizedName( String name );

    /**
     * Delete category from datastore
     *
     * @param id id of {@link com.dodo.blog.model.Category} entity to delete
     */
    void deleteCategory( Long id );
}
